#Title: Head section : JavaScript Where To ... : Examples
Scripts that contain functions go in the head section of the document. Then we can be sure that the script is loaded before the function is called
<html>
<head>
<script type="text/javascript">
function message()
{alert("This alert box was called with the onload event")}
</script>
</head>
<body onload="message()">
</body>
</html>
#Title: JavaScript Where To ... : Examples
#Element: 81: JavaScript Where To ... : Examples
#Article: 78: JavaScript Where To ...